package com.ss.android.article.base.feature.detail.model;

import com.ss.android.image.model.ImageInfo;

import org.json.JSONObject;

public final class GalleryImageInfo {
    public ImageInfo subImage;
    public String subTitle;
    public String subAbstract;

    private GalleryImageInfo() {

    }

    public static GalleryImageInfo fromJSONObject(JSONObject jo) {
        if (jo == null) {
            return null;
        }

        GalleryImageInfo galleryImageInfo = new GalleryImageInfo();
        try {
            galleryImageInfo.subTitle = jo.optString("sub_title");
            galleryImageInfo.subAbstract = jo.optString("sub_abstract");
            JSONObject subImage = jo.optJSONObject("sub_image");
            if (subImage == null) {
                return galleryImageInfo;
            }
            galleryImageInfo.subImage = ImageInfo.fromJson(subImage, true);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return galleryImageInfo;
    }
}

